﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using Models;
using BLL;

namespace Dryricenet
{
    public partial class home_ZC : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        //注册
        protected void Button1_Click(object sender, EventArgs e)
        {
            User us = new User
            {
                UserName = userNname.Text.Trim(),
                Pwd = surePassword.Text.Trim(),
                Phone = phone.Text.Trim(),
            };
            if (userNname.Text.Trim() != "" && surePassword.Text.Trim() != "" && phone.Text.Trim() != "")
            {
                if (userBLL.UserCF(userNname.Text.Trim()) == null)
                {
                    if (userBLL.addUserYHBLL(us))
                    {
                        Response.Write("<script>alert('注册成功！');location.href='home_DL.aspx'</script>");
                       
                    }
                    else
                    {
                        Response.Write("<script>alert('注册失败！')</script>");
                    }
                }
                else
                {
                    Response.Write("<script>alert('此用户已存在！请更改用户名。')</script>");
                }
            }
            else {
                Response.Write("<script>alert('请将信息填写完整！')</script>");
            }
            
        }
    }
}